The Time Machine, identify drought events

Hello there! 👋 We're excited to take you on an insightful journey through our interactive notebook designed to explore drought events across the globe over time. Our main focus will be on understanding how droughts have varied both geographically and temporally.

To reach this goal we need to recognize and analyze drought occurrences worldwide from the year 1940 up to the present. We will do this by examining the Standardized Precipitation Evapotranspiration Index (SPEI) values, which help us understand moisture deficit better.

📌 Since each of you has different needs and interests, we've made the notebook as interactive as possible. We'll guide you through the cells, but you'll have the freedom to choose what to focus on: the geographical area, the type of index aggregation, and the time period.

What is SPEI?

The SPEI is a powerful index used by scientists to determine drought conditions. It considers both precipitation and evapotranspiration (the sum of evaporation and plant transpiration from the Earth's surface to atmosphere) to give a standardized measure of moisture adequacy in different regions and times. You can find more info on the dedicate page of our handbook.

Data Source

The data we will use comes from ERA5, one of the most comprehensive atmospheric data services available. Specifically, we are working with 'nc' files, which are a type of data file used for storing complex scientific data in a format that can be accessed and processed efficiently (to get deeper see the dedicate page).

Let's dive in and start our exploration to better understand the patterns and impacts of droughts around the world! 🌍

What we will do

In this notebook, we will explore drought events from various points of view:

  1. By selecting a geographic area and a month of the year, we will observe the evolution of drought conditions from 1940 to the present using a slider of maps.
  2. We will study the same evolution using a scatterplot made with median and mean values for that area.
  3. We will delve deeper into the details with a boxplot and a standard deviation bar chart for the same month and area.
  4. We will change the time dimension by looking at the evolution of the median values for a certain year across the twelve months.
  5. Finally, we will see the evolution over a range of years of our choice via a stripe chart, split by years and months.

Setting Up the Environment

Before we dive into the data analysis, we need to ensure our notebook has all the necessary tools and libraries. The following cells involve installing various Python packages that will help us manipulate data, create visualizations, and interact with our notebook more effectively.

For more detailed information on these steps, you can refer to the Setting Up chapter in the handbook. Alternatively, you can simply run these cells and proceed to the first analysis section.

So let's start by installing the packages:

Now we enable the IPython widget extensions:

and import thenecessary Python libraries and modules that we'll use throughout our analysis.

We need to import also 4 custom modules from the utils folder: widgets_handler, coordinates_retriver, data_preprocess and charts. These modules contain custom functions tailored to handle widgets, retrieve coordinates, preprocess data, and create charts.

This cell sets up the initial state and interface for the interactions:

Now we sets up and configures the widgets:

The functions in the next cell handle user input, process data based on those inputs, and update the notebook interface accordingly:

1. Title Section 1...

It's time for our first analysis. We will selected a geographic area, a... Regarding the choice of the area, please take into account that the larger the area, the more computational power and time it will take to retrieve the data. So, if your device is not powerful, choose smaller areas, such as second-level subareas.

If you click the 'Get data' button before choosing the necessary options from the dropdown menu, a message will be displayed under the widgets' block explaining what you missed.

If all the selections are made, you will receive three messages:

  1. The retrieval of the coordinates for the selected area was successful ('Coordinates retrieved for...').
  2. The data retrieval was successful ('SPEI subset data uploaded for...')
  3. A map of the selected area is displayed, which can help you check if the area is the one you are interested in.

Now you have retrieved the data of your interest in a variable named subset_data[index], where index is the SPEI index you have chosen.

Using the data_preprocess.display_data_details function, you can examine your data to check the following:

The list of countries, subareas, and their boundaries is obtained from the geoBoundaries Global Database of Political Administrative Boundaries Database.